# coding:utf-8
from xadmin import views

__author__ = 'Miller'
__date__ = '2017/3/20 13:46 '
import xadmin
from .models import UserProfile, UserEmailVerifyCode, Banner


class BaseSettings(object):
    enable_themes = True
    use_bootswatch = True


class GlobleSettings(object):
    site_title = '暮雪后台管理系统'
    site_footer = '暮雪在线'
    menu_style = 'accordion'


class UserProfileAdmin(object):
    search_fields = ['username', 'email', 'is_active', 'date_joined', 'nick_name', 'birday', 'gender', 'adress',
                     'mobile', 'image']
    list_filter = ['username', 'email', 'is_active', 'date_joined', 'nick_name', 'birday', 'gender', 'adress', 'mobile',
                   'image']
    list_display = ['username', 'email', 'is_active', 'date_joined', 'nick_name', 'birday', 'gender', 'adress',
                    'mobile', 'image']


class UserEmailVerifyCodeAdmin(object):
    search_fields = ['email', 'send_type', 'send_type']
    list_display = ['code', 'email', 'send_type', 'send_time']
    list_filter = ['code', 'email', 'send_type', 'send_time']


class BannerAdmin(object):
    search_fields = ['title', 'image', 'index', 'url', 'add_time']
    list_display = ['title', 'image', 'index', 'url', 'add_time']
    list_filter = ['title', 'image', 'index', 'url', 'add_time']


xadmin.site.register(UserProfile, UserProfileAdmin)
xadmin.site.register(UserEmailVerifyCode, UserEmailVerifyCodeAdmin)
xadmin.site.register(Banner, BannerAdmin)
xadmin.site.register(views.BaseAdminView, BaseSettings)
xadmin.site.register(views.CommAdminView, GlobleSettings)
